package com.stars.pao.springbook.config;

import com.stars.pao.springbook.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;


@Slf4j
@ResponseBody
@ControllerAdvice
public class ErrorHandler {
//    捕获异常
    public Result handler(Exception e) {
        log.error("捕获异常 e:", e);
        return Result.fail(e.getMessage());
    }
}
